package com.wlp.finance.biz.service.impl;


import com.wlp.common.exception.BizException;
import com.wlp.common.exception.ParameterException;
//import com.wlp.common.service.TokenService;
import com.wlp.finance.biz.domain.MemberBindPhone;
//import com.wlp.finance.biz.dto.AdminDTO;
//import com.wlp.finance.biz.dto.form.UpdatePasswordForm;
//import com.wlp.finance.biz.dto.form.UpdatePhoneForm;
import com.wlp.finance.biz.mapper.MemberBindPhoneMapper;
import com.wlp.finance.biz.service.MemberBindPhoneService;
import com.wlp.mybatis.help.MyBatisWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

import java.util.Objects;

import static com.wlp.finance.biz.domain.MemberBindPhoneField.*;

/**
 * @author wlp
 * @date 2024/05/30 21:12
 **/
@Service
@Slf4j
@RequiredArgsConstructor
public class MemberBindPhoneServiceImpl implements MemberBindPhoneService {
    final MemberBindPhoneMapper memberBindPhoneMapper;
//    final PasswordEncoder passwordEncoder;


    /**
     * 根据手机号获取用户信息
     * @Author: wlp
     * @Date: 2024/5/30 21:13
     * @param phone:
     * @return: com.wlp.finance.biz.domain.MemberBindPhone
     **/
    @Override
    public MemberBindPhone getMemberByPhone(String phone) {
        MyBatisWrapper<MemberBindPhone> myBatisWrapper = new MyBatisWrapper<>();
        myBatisWrapper.select(MemberId,Phone,Password)
                .whereBuilder().andEq(setPhone(phone));
        // select member_id,phone,password from member_bind_phone where phone = ?
        return memberBindPhoneMapper.topOne(myBatisWrapper);
    }
}
